/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
jQuery(document).ready(function($){
	  $('#message_sucess').hide();
    $('#contact_form').submit(function(){
        var email = $('#email').val();
        var fname = $('#fullname').val();
        var message = $('#message').val();
        var url = cform_obj.url;
        var error = 0;
        if ( fname.length == 0 )
        {
            $('#fullname_msg').html('Invalid Fullname'); error = 1;
           
        }
        if ( email.length == 0 )
        {
            $('#email_msg').html('Invalid Email address');error = 1;
            
        }
        if ( message.length == 0 )
        {
               $('#message_msg').html('Invalid Message');error = 1;
        }
        if ( error )
        {
                return false;
        }
        
        $.post(url + '/request/um_contactform.php',{'email' : email, 'fname' : fname, 'message' : message}, function(data){
            
           var data = $.parseJSON(data);
           if ( data.message == 'Your message has been sent')
          {
              $('#contact_form').remove();
							$('#message_sucess').show();
          }
        });
        return false;
    });
    
});

